import React, { Component } from 'react';
import styles from './style.scss';
import PropTypes from 'prop-types';
import { TreeSelect } from 'antd';

class TreeSelects extends Component {
    static propTypes = {
        error: PropTypes.bool
    };

    static defaultProps = {
        error: false
    };

    render() {
        const { error, className, dropdownClassName, ...others } = this.props;
        let classNames = `${styles.treeSelect}`;
        let dropdownClassNames = `${styles.dropDown}`;
        className && (classNames += ` ${className}`);
        error && (classNames += ` ${styles.error}`);
        dropdownClassName && (dropdownClassNames += ` ${dropdownClassName}`);
        return <TreeSelect className={classNames} dropdownClassName={dropdownClassNames} {...others} />;
    }
}

export default TreeSelects;